home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
TCL1
/
CDICTION
/
CPATTERN.C
< prev
next >
Wrap
Text File
|
1989-09-15
|
2KB
|
71 lines
/*****************************************************************************
CDictionary.c
see header for more information.
SUPERCLASS = CPane
*****************************************************************************/
#include "CPattern.h"
#include "TaoUtils.h"
#include "TBUtilities.h"
#include "OSChecks.h"
/*****************************************************************************/
void CPattern::IPattern(CView *anEnclosure, CBureaucrat *aSupervisor,
Int16 aWidth, Int16 aHeight, Int16 aHEncl, Int16 aVEncl,
SizingOption aHSizing, SizingOption aVSizing,
Int16 resID, Int16 preferColor)
{
Handle patH, copy;
CPane::IPane( anEnclosure, aSupervisor, aWidth, aHeight,
aHEncl, aVEncl, aHSizing, aVSizing);
/* get the monochrome pattern */
patH = GetResource( 'PAT ', resID);
if (patH)
{
BlockMove( *patH, itsPattern, sizeof( Pattern));
ReleaseResource( patH);
}
else BlockMove( gray, itsPattern, sizeof( Pattern));
itsPixPat = NIL;
if (preferColor && ColorQDIsPresent()) /* see of a pixpat is available */
{
/* IM V says GetPixPat returns NIL if the
resource doesn't exist */
itsPixPat = GetPixPat( resID);
}
} /* CPattern::IPattern */
/*****************************************************************************/
virtual void CPattern::Draw( Rect *area)
{
/* if itsPixPat is not nil then we already know ColorQD exists */
if ((itsPixPat)&&IsDeepPort())
FillCRect( area, itsPixPat);
else
{
HLock( this);
FillRect( area, itsPattern);
HUnlock( this);
}
} /* CPattern::Draw */
/*****************************************************************************/
void CPattern::Dispose( void)
{
if (itsPixPat)
DisposPixPat( itsPixPat);
inherited::Dispose();
} /* CPattern::Dispose */
/*****************************************************************************/